import java.awt.Graphics2D;
import java.awt.Image;

import javax.swing.ImageIcon;


public class Door implements GameObject{
	
	private int x, y, width, height, type, xSpeed, ySpeed;
	private Image spriteOpen, spriteClosed;
	private Game observer;
	
	public Door(int x, int y, String spritePathOpen, String spritePathClosed, Game observer){
		this.x = x;
		this.y = y;
		this.observer = observer;
		
		ImageIcon ii = new ImageIcon(this.getClass().getResource(spritePathOpen));
		spriteOpen = ii.getImage();
		ii = new ImageIcon(this.getClass().getResource(spritePathClosed));
		spriteClosed = ii.getImage();
		
		width = spriteOpen.getWidth(null);
		height = spriteOpen.getHeight(null);
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}

	public int getType() {
		if (observer.power)
			return 10;
		else
			return 2;		
	}

	public int getYSpeed() {
		return ySpeed;
	}

	public int getXSpeed() {
		return xSpeed;
	}

	public void specialFunction(int type) {
		
	}

	public void draw(Graphics2D g2d, Game observer) {
		if (observer.power)
			g2d.drawImage(spriteOpen, x, y, observer);
		else
			g2d.drawImage(spriteClosed, x, y, observer);
	}

	@Override
	public int projectileCollision(int type) {
		return -1;
		
	}

}
